<script setup lang='ts'>
import { StyleValue } from 'vue'


const props = defineProps<{
    shadow?: 'never' | 'hover' | 'always'
}>()



const setCardShadow = (): StyleValue => {
    // 
    let styleMap = {
        never: () => ({ boxShadow: 'none' }),
        hover: () => ({ transition: 'box-shadow 0.3s' }),
        always: () => ({ boxShadow: '0px 4px 8px rgba(0, 0, 0, 0.1)' }),
    }
    return styleMap[props.shadow as 'never' | 'hover' | 'always']() as StyleValue
}
</script>



<template>
    <div class="card-container" :style="setCardShadow()">
        <slot name="header"> </slot>
        <div class="card-main">
            <slot></slot>
        </div>
    </div>

</template>


<style lang='scss' scoped>
.card-container {
    background-color: var(--v3-bg-color);
    box-shadow: 1px 1px var(--el-box-shadow-light);
    border: 1px solid var(--el-border-color);
    display: inline-block;
    min-width: 300px;
    border-radius: 4px;

    .card-title {
        border-bottom: 1px solid var(--el-border-color);
        height: 40px;
        line-height: 40px;
        padding-left: 20px;
        font-size: 14px;
    }

    .card-main {
        padding: 20px;
    }
}
</style>